Class HCC.DT.HCC2HL72.NewOrderRequst Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200901UV:POOR_IN200901UV' targetDocType='2.5.1:OMP_O09' create='new' language='objectscript' >
<assign value='source.{id(1).extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime(1).value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"OMP"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"O09"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.time.validTimeLow}' property='target.{ORCgrp(1).ORC:OrderEffectiveDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.signatureText.value}' property='target.{ORCgrp(1).ORC:OrderingProvider(1).GivenName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup(1).author.assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp(1).ORC:OrderingProvider(1).FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().representedOrganization.id().item().extension}' property='target.{ORCgrp().ORC:OrderingFacilityName().IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().representedOrganization.name}' property='target.{ORCgrp().ORC:OrderingFacilityName().OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().time.value}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).EffectiveDate}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp(1).ORC:VerifiedBy(1).GivenName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().author.assignedEntity().representedOrganization.id().item().root}' property='target.{ORCgrp(1).ORC:EnteringOrganization.Identifier}' action='set' />
<assign value='"LAB"' property='target.{ORCgrp().ORC:OrderType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).id(1).item(2).extension}' property='target.{PIDgrp.PV1grp.PV1:VisitNumber.IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).code.code}' property='target.{PIDgrp.PV1grp.PV1:AdmissionType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).code.code}' property='target.{PIDgrp.PV1grp.PV1:PatientClass}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.id.item().extension}' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).location(1).serviceDeliveryLocation(1).location.asLocatedEntityPartOf(1).location(1).id.item(1).extension}' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name})' property='target.{PIDgrp.PV1grp.PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.telecom},"//s:item/@value")' property='target.{PIDgrp.PID:PhoneNumberHome(1).TelephoneNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.placerGroup(1).effectiveTime},"&gt;")_"&gt;","//s:low/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).StartDateTime}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.placerGroup(1).effectiveTime},"&gt;",2)_"&gt;","//s:high/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).EndDateTime}' action='set' />
<assign value='"2.5"' property='target.{MSH:VersionID}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.addr})' property='target.{PIDgrp.PID:PatientAddress(1)}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).id.item(1).extension}' property='target.{PIDgrp.PID:PatientID}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).extension}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).component2(1).choice.observationRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).root}' property='target.{PIDgrp.PID:PatientIdentifierList(1).IdentifierTypeCode}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.administrativeGenderCode.code}' property='target.{PIDgrp.PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.birthTime.value}' property='target.{PIDgrp.PID:DateTimeofBirth}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.name})' property='target.{PIDgrp.PID:PatientName(1)}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().asContent().containerPackagedProduct().capacityQuantity.unit}' property='target.{ORCgrp().RXCgrp().RXC:ComponentUnits.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().asContent().containerPackagedProduct().capacityQuantity.value}' property='target.{ORCgrp().RXCgrp().RXC:ComponentAmount}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().routeCode.code}' property='target.{ORCgrp().RXR():Route.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().routeCode.displayName.value}' property='target.{ORCgrp().RXR():Route.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseQuantity.value}' property='target.{ORCgrp().RXO:RequestedGiveAmountMinimum}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseQuantity.unit}' property='target.{ORCgrp().RXO:RequestedGiveUnits.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseCheckQuantity.item().numerator}' property='target.{ORCgrp().RXO:TotalDailyDose.Quantity}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().doseCheckQuantity.item().denominator}' property='target.{ORCgrp().RXO:TotalDailyDose.Units.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().administrationUnitCode.code}' property='target.{ORCgrp().RXR():AdministrationSite.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().administrationUnitCode.displayName.value}' property='target.{ORCgrp().OBXgrp()}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().subjectOf3().policy().code().displayName.value}' property='target.{ORCgrp().RXO:PharmacyOrderType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().code.code}' property='target.{ORCgrp().RXO:RequestedGiveCode.Identifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().consumable2().choice.choice.manufacturedProduct1().manufacturedProduct().name.validTimeLow}' property='target.{ORCgrp().RXO:RequestedGiveCode.Text}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().subjectOf6().annotation().text()}' property='target.{ORCgrp().NTE():Comment()}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().pertinentInformation().choice.choice.observation().value}' property='target.{ORCgrp().NTE():CommentType}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().component2().choice.supplyRequest().quantity.value}' property='target.{ORCgrp().RXO:RequestedDispenseAmount}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.substanceAdministrationRequest().component2().choice.supplyRequest().quantity.unit}' property='target.{ORCgrp().RXO:RequestedDispenseUnits.Text}' action='set' />
</transform>
}

}
